/**
 * Created by aa on 2016/8/22.
 */
$(function(){
    var money=0;
$('#rechaarge').on('input',function(event){
    if($('#rechaarge').val()!=''){
        $('#commit').removeAttr('disabled');
        //转化为以分为单位
        money=$('#rechaarge').val()*100;
    }
    else{
        $('#commit').attr('disabled','disabled');
    }
});

$('#commit').on('click',function(){
    layer.open({
        type: 2
    });
    var parameters = getParametersObj();
    var formOperation=new FormOperation();
    var submitForm = formOperation.getNewSubmitForm();
    var dataOperation=new DataOperation();
    formOperation.createNewFormElement(submitForm, "mchnt_cd", decodeURIComponent(parameters.mchntCd));
    formOperation.createNewFormElement(submitForm, "mchnt_txn_ssn", decodeURIComponent(parameters.mchntTxnSsn));
    formOperation.createNewFormElement(submitForm, "login_id", decodeURIComponent(parameters.loginId));
    formOperation.createNewFormElement(submitForm, "amt", money);
    formOperation.createNewFormElement(submitForm, "page_notify_url", decodeURIComponent(parameters.pageNotifyUrl));
    formOperation.createNewFormElement(submitForm, "back_notify_url", "");
    dataOperation.getPostSign(money+'||'+decodeURIComponent(parameters.loginId)+'|'+decodeURIComponent(parameters.mchntCd)+'|'+decodeURIComponent(parameters.mchntTxnSsn)+'|'+decodeURIComponent(parameters.pageNotifyUrl),function(result){
        formOperation.createNewFormElement(submitForm, "signature", result);
        submitForm.action = UrlInformation.formAction+"500002.action";
        submitForm.submit();
    });
   /* console.log(decodeURIComponent(parameters.mchntCd)+'|'+decodeURIComponent(parameters.mchntTxnSsn));
    console.log(money+'||'+decodeURIComponent(parameters.loginId)+'|'+decodeURIComponent(parameters.mchntCd)+'|'+decodeURIComponent(parameters.mchntTxnSsn)+'|'+decodeURIComponent(parameters.pageNotifyUrl));*/

});

});